package com.zbkj.service.dividend.event;

import com.zbkj.common.model.order.Order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 用户分红池变更事件
 * +----------------------------------------------------------------------
 * | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
 * +----------------------------------------------------------------------
 * | Author: CRMEB Team <admin@crmeb.com>
 * +----------------------------------------------------------------------
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "UserDividendEvent对象", description = "用户分红池分红事件")
public class DividendEvent implements Serializable {

    @ApiModelProperty(value = "订单")
    private Order order;

    @ApiModelProperty(value = "事件发生时间")
    private LocalDateTime eventTime;

    /**
     * 无参构造函数
     */
    public DividendEvent() {
        this.eventTime = LocalDateTime.now();
    }

    public DividendEvent(Order order) {
        this.order = order;
        this.eventTime = LocalDateTime.now();
    }

    /**
     * 根据变更类型创建事件
     */
    public static DividendEvent createDividendEvent(Order order) {
        return new DividendEvent(order);
    }
}